﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HWR_Ants.Classes
{
    public class UpdateEventArgs : EventArgs
    {
        private readonly int ro_CurrentIteration;
        private readonly int ro_SuccessfulIterations;
        private readonly int ro_Failures;
        private readonly double ro_CurrentBestValue;
        private readonly double ro_LastValue;
        private readonly IEnumerable<City> ro_BestTour;

        public UpdateEventArgs(
            int current_Iteration,
            int successful_Iterations,
            int failures,
            double current_best_value,
            double last_value,
            IEnumerable<City> bestTour )         
        {
            ro_BestTour = bestTour;
            ro_CurrentBestValue = current_best_value;
            ro_CurrentIteration = current_Iteration;
            ro_Failures = failures;
            ro_LastValue = last_value;
            ro_SuccessfulIterations = successful_Iterations;
        }

        public int CurrentIteration
        {
            get { return ro_CurrentIteration; }
        }

        public int SuccessfulIterations
        {
            get { return ro_SuccessfulIterations; }
        }

        public int Failures
        {
            get { return ro_Failures; } 
        }

        public double CurrentBestValue
        {
            get { return ro_CurrentBestValue; }
        }

        public double LastValue
        {
            get { return ro_LastValue; }
        }

        public IEnumerable<City> BestTour
        {
            get { return ro_BestTour; }
        }

        public override string ToString()
        {
            return String.Format("Iteration: {1}{0}w/o change: {2}{0}failed: {3}{0}value: {4:f1}{0}last: {5:f1}",
             Keys.Tab, CurrentIteration, SuccessfulIterations, Failures, CurrentBestValue, LastValue);
        
        }
    }
}
